<?php
/**
 * Created by PhpStorm.
 * User: MrHung
 * Date: 7/2/14
 * Time: 3:34 PM
 */
session_start();
error_reporting(0);
if (   isset ( $_POST['href'] )) {
    $post['href'] = trim( ucfirst( $_POST['href'] ) );
    $post['position'] = trim( strtolower( $_POST['position'] ) );
    $post['image'] = $_POST['image'];


    //<---  * REQUIRE * ----->
    require_once('../../class_ajax_request/classAjaxAdmin.php');
    include_once('../../application/functions.php');
    include_once('../../application/DataConfig.php');

     $arr = array(
         'href'=>$post['href'],
         'images'=>$post['image'],
         'position'=>$post['position']
     );
    $objs = new AjaxRequestAdmin();
    //UPDATE BD
    $res = $objs->addAds($arr);

    if($res == true){
        $response = array(
            'success'=>true,
            'message'=>'Create category success!'
        );
    }else{
        $response = array(
            'success'=>false,
            'message'=>'Error, create fail!'
        );
    }
    echo  json_encode($response);  die;

}// END IF SESSION ACTIVE